package com.avic.system.service.impl;

import com.avic.system.dal.condition.FindLoginLogListCondition;
import com.avic.system.dal.model.LoginLog;
import com.avic.system.dal.model.SystemUser;
import com.avic.system.service.LoginLogService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author huangsheng on 2018/12/10
 */
@Service
public class LoginLogServiceImpl extends SystemAbstractServiceImpl implements LoginLogService {

    @Override
    public List<LoginLog> loginLogList(FindLoginLogListCondition findLoginLogListCondition) {
        return loginLogMapper.loginLogList(findLoginLogListCondition);
    }

    @Override
    public int loginLogListTotalCount(FindLoginLogListCondition findLoginLogListCondition) {
        return loginLogMapper.loginLogListTotalCount(findLoginLogListCondition);
    }

    @Override
    public void updateLoginDuration(String userId) {
        SystemUser systemUser = systemUserMapper.queryUserById(userId);

        loginLogMapper.updateLoginDuration(systemUser.getLoginId());
    }
}
